{% load opencve_extras %}

<h2 class="page-header">Metrics</h2>

<div class="nav-tabs-custom nav-tabs-primary">
    <ul class="nav nav-tabs">
        <li class="active">
            {% if cve.cvssV4_0 %}
            <a href="#cvss40" data-toggle="tab">CVSS v4.0 <span class="label label-{{ cve.cvssV4_0.score|cvss_level }} label-cvss">{{ cve.cvssV4_0.score }} {{ cve.cvssV4_0.score|cvss_human_score|title }}</span></a>
            {% else %}
            <a href="#cvss40" data-toggle="tab">CVSS v4.0 <span class="label label-default label-cvss">N/A</span></a>
            {% endif %}
        </li>
        <li>
            {% if cve.cvssV3_1 %}
            <a href="#cvss31" data-toggle="tab">CVSS v3.1 <span class="label label-{{ cve.cvssV3_1.score|cvss_level }} label-cvss">{{ cve.cvssV3_1.score }} {{ cve.cvssV3_1.score|cvss_human_score|title }}</span></a>
            {% else %}
            <a href="#cvss31" data-toggle="tab">CVSS v3.1 <span class="label label-default label-cvss">N/A</span></a>
            {% endif %}
        </li>
        <li>
            {% if cve.cvssV3_0 %}
            <a href="#cvss30" data-toggle="tab">CVSS v3.0 <span class="label label-{{ cve.cvssV3_0.score|cvss_level }} label-cvss">{{ cve.cvssV3_0.score }} {{ cve.cvssV3_0.score|cvss_human_score|title }}</span></a>
            {% else %}
            <a href="#cvss30" data-toggle="tab">CVSS v3.0 <span class="label label-default label-cvss">N/A</span></a>
            {% endif %}
        </li>
        <li>
            {% if cve.cvssV2_0 %}
            <a href="#cvss2" data-toggle="tab">CVSS v2 <span class="label label-{{ cve.cvssV2_0.score|cvss_level }} label-cvss">{{ cve.cvssV2_0.score }} {{ cve.cvssV2_0.score|cvss_human_score|title }}</span></a>
            {% else %}
            <a href="#cvss2" data-toggle="tab">CVSS v2 <span class="label label-default label-cvss">N/A</span></a>
            {% endif %}
        </li>
        <li>
            {% if cve.kev.data %}
            <a href="#kev" data-toggle="tab">KEV <span class="label label-danger label-cvss">yes</span></a>
            {% else %}
            <a href="#kev" data-toggle="tab">KEV <span class="label label-default label-cvss">no</span></a>
            {% endif %}
        </li>
        <li>
            {% if cve.ssvc.data %}
            <a href="#ssvc" data-toggle="tab">SSVC <span class="label label-danger label-cvss">yes</span></a>
            {% else %}
            <a href="#ssvc" data-toggle="tab">SSVC <span class="label label-default label-cvss">no</span></a>
            {% endif %}
        </li>
    </ul>
    <div class="tab-content">
        <div class="tab-pane active" id="cvss40">
            {% if cve.cvssV4_0 %}
            {% include "cves/metrics/cvssV4_0.html" with cvss=cve.cvssV4_0 %}
            {% else %}
            <p class="alert alert-info">No CVSS v4.0</p>
            {% endif %}
        </div>
        <div class="tab-pane" id="cvss31">
            {% if cve.cvssV3_1 %}
            {% include "cves/metrics/cvssV3_x.html" with cvss=cve.cvssV3_1 %}
            {% else %}
            <p class="alert alert-info">No CVSS v3.1</p>
            {% endif %}
        </div>
        <div class="tab-pane" id="cvss30">
            {% if cve.cvssV3_0 %}
            {% include "cves/metrics/cvssV3_x.html" with cvss=cve.cvssV3_0 %}
            {% else %}
            <p class="alert alert-info">No CVSS v3.0</p>
            {% endif %}
        </div>
        <div class="tab-pane" id="cvss2">
            {% if cve.cvssV2_0 %}
            {% include "cves/metrics/cvssV2_0.html" with cvss=cve.cvssV2_0 %}
            {% else %}
            <p class="alert alert-info">No CVSS v2</p>
            {% endif %}
        </div>
        <div class="tab-pane" id="kev">
            {% if cve.kev.data %}
            {% include "cves/metrics/kev.html" with kev=cve.kev.data %}
            {% else %}
            <p class="alert alert-info">This CVE is not in the KEV list.</p>
            {% endif %}
        </div>
        <div class="tab-pane" id="ssvc">
            {% if cve.ssvc.data %}
            {% include "cves/metrics/ssvc.html" with ssvc=cve.ssvc.data %}
            {% else %}
            <p class="alert alert-info">Key SSVC decision points have not yet been added.</p>
            {% endif %}
        </div>
    </div>
</div>
